{% extends "base.html" %}



{% block css %}
<link rel="stylesheet" href="/static/css/admin.css">
<link rel="stylesheet" href="/static/ztree3/css/bootstrapStyle/bootstrapStyle.css" type="text/css">
{% endblock %}


{% block center %}


<!--头部导航-->
<div class="panel panel-default center-top" style="min-width:1300px;">
  <div class="panel-body">
    <ol class="breadcrumb" style="margin-bottom: 0px;background-color: #FFFFFF;">
      <li><a href="/" style="color: #377CD8;">首页</a></li>
      <li><a href="javascript:;">日志管理</a></li>
      <li class="active">{{ title }}</li>
    </ol>
  </div>
</div>



<!--用户信息-->
<div class="panel panel-default center-top" style="min-width:1300px;">
  <div class="panel-heading">
      <div class="row" style="padding-top:5px;padding-left:10px;">
          <div class="col-sm-6">

              <span style="color:#20B320" ><strong>任务中心</strong></span>

          </div>

      </div>

  </div>
  <div class="panel-body">

        <div style="margin-bottom: 10px;">

            <div class="col-sm-12">
                <table class="table table-hover table-bordered">
                  <thead>
                    <tr style="background-color: #f5f5f5;">

                      <th>任务</th>
                      <th>任务ID</th>
                      <th>用户</th>
                      <th>开始时间</th>
                      <th>状态</th>
                      <th>日志</th>
                    </tr>
                  </thead>
                  <tbody id="task_table">
                {% for i in task_list %}
                    <tr name="tbody">
                      <td>{{ i.task_name }}</td>
                      <td>{{ i.task_id }}</td>
                      <td>{{ i.task_user }}</td>
                      <td>{{ i.create_time|date:"Y-m-d H:i:s" }}</td>
                        {% if i.status == "SUCCESS" %}
                      <td style="color:green">{{ i.status }}</td>
                        {% else %}
                      <td style="color:red">{{ i.status }}</td>
                        {% endif %}
                      <td style="padding-left:15px;">

                        <a href="javascript:;" name="check-task-log" task_id="{{ i.id }}" style="text-decoration:none;" data-toggle="tooltip" data-placement="right" title="查看"><span class="fa fa-file-text fa-lg"></span></a>&nbsp;&nbsp;&nbsp;

                      </td>
                    </tr>
                  {% endfor %}
                  </tbody>
                </table>

                <div class="text-right" style="margin-top:-30px;padding-right:9%">
                  <ul class="pagination" id="pagination">
                  </ul>
                </div>


            </div>

        </div>
  </div>
</div>



{% endblock %}


{% block modal %}

<div class="modal fade" id="taskModal" tabindex="-1" role="dialog" aria-labelledby="taskModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content" style="margin-top:130px;margin-left:-20%;min-width:800px;">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="taskModalLabel">任务日志</h4>
      </div>
      <div class="modal-body">
        <pre id="task-log" style="background-color:black;color:green;font-size:16px;overflow:auto;max-height:600px;"></pre>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>

{% endblock %}






{% block js %}
<script type="text/javascript">
    $(function () {
          $('[data-toggle="tooltip"]').tooltip()
        })
    
    $("a[name='check-task-log']").click(function(){
        var task_id=$(this).attr("task_id");
        $.post('/log/tasklog/',{'task_id':task_id},function(data){
            $("#task-log").empty();
            $("#task-log").append(data);
            $("#taskModal").modal('show');
    
        });
    });

</script>

{% endblock %}


